﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sketchial.Data;
using System.Data;

namespace Sketchial.Business
{
    public class LoginMessage
    {
        public bool IsSuccessful { get; set; }
        public bool UserExists { get; set; }
    }

    public class LoginHelper
    {
        private TableHelper tableHelper = new TableHelper();

        public LoginMessage CheckIfUserExists(string userId)
        {
            LoginMessage response = new LoginMessage();

            if (!string.IsNullOrEmpty(userId))
            {
                if (tableHelper.GetUserByFacebookID(userId) == null)
                {
                    response.UserExists = false;
                }
                else
                    response.UserExists = true;
            }

            return response;
        }

        public UserEntity GetUserInfoByFacebookID(string id)
        {
            return tableHelper.GetUserByFacebookID(id);
        }

        public ObjectEntity GetObjectByID(string id)
        {
            return tableHelper.GetObjectByID(id);
        }

        public List<ObjectEntity> GetObjectsByClassAsList(string className)
        {
            return tableHelper.GetObjectsByClassInList(className);
        }

        public DataTable GetObjectsByClass(string className)
        {
            return tableHelper.GetObjectsByClass(className);
        }
    }
}
